package com.hmyd.hmyd_android.utils;

import com.hmyd.hmyd_android.AppBasic;
import com.hmyd.hmyd_android.R;
import com.hmyd.hmyd_android.commons.UrlConstant;
import com.hmyd.hmyd_android.crypto.Crypto;
import com.hmyd.hmyd_android.ui.BindBankCardActivity;
import com.hmyd.hmyd_android.ui.CreateAccountActivity;
import com.hmyd.hmyd_android.ui.LoginActivity;
import com.hmyd.hmyd_android.ui.TradingPasswordActivity;
import com.hmyd.hmyd_android.ui.TransitionActivity;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

public class HttpExceptionHandler {

	public static void exceptionHandler(Context context,long code){

		if(context==null){
			return;
		}

		if(code==200001){// 未开户
			context.startActivity(new Intent(context,CreateAccountActivity.class));
		}else if(code==200002){//未绑银行卡
			context.startActivity(new Intent(context, BindBankCardActivity.class));
		}else if(code==200003){//未设置交易密码
			//			MyToast.showToast(context, "请先设置交易密码");
			context.startActivity(TradingPasswordActivity.getIntent(context, context.getResources().getString(R.string.setting_trading_password)));
		} else if(code==100401){// 未登录
			
			context.startActivity(new Intent(context, TransitionActivity.class));
			
//			AppBasic.isLogin = false;
//			if(!AppBasic.getInstance().isActivityLive(LoginActivity.class)) {
//				context.startActivity(new Intent(context, LoginActivity.class));
//			}
		} else if(code==100083) {
			AppBasic.isLogin = false;
		}
	}

}
